import { createRouter, createWebHistory } from "vue-router";

export const leftMenu = [
  {
    path: "/home",
    name: "Home",
    component: () => import("src/pages/module/pages/home/home.vue"),
    meta: {
      title: "首页",
      sort:0
    },
  },
  {
    path: "/baseManage",
    name: "BaseManage",
    component: () => import("src/layout/layout.vue"),
    meta: {
      title: "基础管理",
      sort:1
    },
    children:[
      {
        path: "/user",
        name: "User",
        component: () => import("src/pages/module/pages/user/user.vue"),
        meta: {
          title: "用户管理",
        },
      },
      {
        path: "/department",
        name: "Department",
        component: () => import("src/pages/module/pages/department/department.vue"),
        meta: {
          title: "部门管理",
        },
      },
      {
        path: "/role",
        name: "Role",
        component: () => import("src/pages/module/pages/role/role.vue"),
        meta: {
          title: "角色管理",
        },
      },
      {
        path: "/access",
        name: "Access",
        component: () => import("src/pages/module/pages/access/access.vue"),
        meta: {
          title: "权限管理",
        },
      },
    ]
  },
  {
    path: "/personal-center",
    name: "PersonalCenter",
    component: () => import("src/pages/module/pages/personal-center/personal-center.vue"),
    meta: {
      title: "个人中心",
      sort:10
    },
  }
]


const routes = [
  {
    path: "/",
    name:"System",
    redirect: '/home',
    component: () => import("src/pages/module/index.vue"),
    children: leftMenu
  },
  {
    path: "/register",
    name:"register",
    component: () => import("src/pages/register/register.vue"),
  },
  {
    path: "/login",
    name:"login",
    component: () => import("src/pages/login/login.vue"),
  },
];

const router = createRouter({
  // history: createWebHashHistory('/nest-access-front'), // hash路由模式
  history: createWebHistory('/nest-access-front'),  // history路由模式
  routes,
});


export default router;
